package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_supervise_info")
public class SuperviseInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "监督检查情况";
	public static final String ALIAS_SUPERVISE_INFO_ID = "superviseInfoId";
	public static final String ALIAS_DRUG_SELL_UNIT_ID = "drugSellUnitId";
	public static final String ALIAS_SUPERVISE_DATE = "时间";
	public static final String ALIAS_SUPERVISE_TYPE = "检查类别";
	public static final String ALIAS_SUPERVISE_RESULT = "结果";
	public static final String ALIAS_DIGHT_INFO = "整改情况";
	public static final String ALIAS_ATTACHMENT_FILE_NAME = "附件文件名";
	public static final String ALIAS_UNIT_TYPE = "企业类别";
	public static final String ALIAS_SUPERVISE_PERSON = "检查人";

	//date formats
	public static final String FORMAT_SUPERVISE_DATE = DATE_FORMAT;


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * superviseInfoId       db_column: supervise_info_id
     */

	private java.lang.Integer superviseInfoId;
    /**
     * drugSellUnitId       db_column: drug_sell_unit_id
     */

	private java.lang.Integer drugSellUnitId;
    /**
     * 时间       db_column: supervise_date
     */

	private java.util.Date superviseDate;
    /**
     * 类别       db_column: supervise_type
     */
	@Length(max=100)
	private java.lang.String superviseType;
    /**
     * 结果       db_column: supervise_result
     */
	@Length(max=100)
	private java.lang.String superviseResult;
    /**
     * 整改情况       db_column: dight_info
     */
	@Length(max=1000)
	private java.lang.String dightInfo;
    /**
     * 附件文件名       db_column: attachment_file_name
     */
	@Length(max=200)
	private java.lang.String attachmentFileName;
    /**
     * 企业类别       db_column: unit_type
     */
	@Length(max=100)
	private java.lang.String unitType;
    /**
     * 检查人       db_column: supervise_person
     */
	@Length(max=100)
	private java.lang.String supervisePerson;
	//columns END


	public SuperviseInfo(){
	}

	public SuperviseInfo(
		java.lang.Integer superviseInfoId
	){
		this.superviseInfoId = superviseInfoId;
	}



	public void setSuperviseInfoId(java.lang.Integer value) {
		this.superviseInfoId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "supervise_info_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getSuperviseInfoId() {
		return this.superviseInfoId;
	}

	@Column(name = "drug_sell_unit_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getDrugSellUnitId() {
		return this.drugSellUnitId;
	}

	public void setDrugSellUnitId(java.lang.Integer value) {
		this.drugSellUnitId = value;
	}

	@Transient
	public String getSuperviseDateString() {
		return DateConvertUtils.format(getSuperviseDate(), FORMAT_SUPERVISE_DATE);
	}
	public void setSuperviseDateString(String value) {
		setSuperviseDate(DateConvertUtils.parse(value, FORMAT_SUPERVISE_DATE,java.util.Date.class));
	}

	@Column(name = "supervise_date", unique = false, nullable = true, insertable = true, updatable = true, length = 23)
	public java.util.Date getSuperviseDate() {
		return this.superviseDate;
	}

	public void setSuperviseDate(java.util.Date value) {
		this.superviseDate = value;
	}

	@Column(name = "supervise_type", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getSuperviseType() {
		return this.superviseType;
	}

	public void setSuperviseType(java.lang.String value) {
		this.superviseType = value;
	}

	@Column(name = "supervise_result", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getSuperviseResult() {
		return this.superviseResult;
	}

	public void setSuperviseResult(java.lang.String value) {
		this.superviseResult = value;
	}

	@Column(name = "dight_info", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getDightInfo() {
		return this.dightInfo;
	}

	public void setDightInfo(java.lang.String value) {
		this.dightInfo = value;
	}

	@Column(name = "attachment_file_name", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getAttachmentFileName() {
		return this.attachmentFileName;
	}

	public void setAttachmentFileName(java.lang.String value) {
		this.attachmentFileName = value;
	}
	@Column(name = "unit_type", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getUnitType() {
		return this.unitType;
	}

	public void setUnitType(java.lang.String value) {
		this.unitType = value;
	}

	@Column(name = "supervise_person", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getSupervisePerson() {
		return this.supervisePerson;
	}

	public void setSupervisePerson(java.lang.String value) {
		this.supervisePerson = value;
	}


	private DrugSellUnit drugSellUnit;
	public void setDrugSellUnit(DrugSellUnit drugSellUnit){
		this.drugSellUnit = drugSellUnit;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "drug_sell_unit_id",nullable = false, insertable = false, updatable = false)
	})
	public DrugSellUnit getDrugSellUnit() {
		return drugSellUnit;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("SuperviseInfoId",getSuperviseInfoId())
			.append("DrugSellUnitId",getDrugSellUnitId())
			.append("SuperviseDate",getSuperviseDate())
			.append("SuperviseType",getSuperviseType())
			.append("SuperviseResult",getSuperviseResult())
			.append("DightInfo",getDightInfo())
			.append("AttachmentFileName",getAttachmentFileName())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getSuperviseInfoId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof SuperviseInfo == false) return false;
		if(this == obj) return true;
		SuperviseInfo other = (SuperviseInfo)obj;
		return new EqualsBuilder()
			.append(getSuperviseInfoId(),other.getSuperviseInfoId())
			.isEquals();
	}
}

